<?php

namespace App\Models;

class Comment extends Base
{

    const TYPE_COOKBOOK = 1;
    const TYPE_NOTEBOOK = 2;

    protected $fillable = ['user_id', 'entity_id', 'type', 'parent_id', 'reply_to_id', 'reply_count', 'message'];



    public function child() {
        return $this->hasMany(Comment::class, 'parent_id');
    }

    public function reply() {
        return $this->belongsTo(Comment::class, 'reply_to_id');
    }

    public function user() {
        return $this->belongsTo(User::class, 'user_id');
    }

}
